#pragma once
#include <string>

class Image
{
public:
	struct Piexl
	{
		unsigned char red;
		unsigned char green;
		unsigned char blue;

		friend Piexl operator +(const Piexl& a, const Piexl& b) {
			return {
				(unsigned char)(a.red + b.red),
				(unsigned char)(a.green + b.green),
				(unsigned char)(a.blue + b.blue)
			};
		}

		friend Piexl operator -(const Piexl& a, const Piexl& b) {
			return {
				(unsigned char)(a.red - b.red),
				(unsigned char)(a.green - b.green),
				(unsigned char)(a.blue - b.blue)
			};
		}
		friend Piexl operator *(const Piexl& p, const float value) {
			return {
				(unsigned char)(p.red * value),
				(unsigned char)(p.green * value),
				(unsigned char)(p.blue * value)
			};
		}
	};

	int width;
	int height;
	Image(std::string path);
	~Image();
	Piexl GetPiexl(int x, int y);
	void SetPiexl(int x, int y, Piexl piexl);
	void Resize(int width, int height);
	void Show(std::string title);
private:
	Piexl* dataPtr;
};


